package A01_一条龙服务;

import ag.script.project.standard.core.*;
import cn.hutool.core.io.FileUtil;

public class Main {
    public static void main(String[] args) {

        //项目路径
        String projectPath = "D:\\MyWorkspace\\Java\\ag-app-res\\ag-apps\\创造与魔法";
        //复制项目
        FileUtil.copy("D:\\MyWorkspace\\AgDevKit\\ag-project\\创造与魔法", FileUtil.getParent(projectPath, 1), true);


        String iconPath = "D:\\MyWorkspace\\Java\\ag-app-res\\ag-apps\\ag_app_res_icon.png";
        String desc = FileUtil.readUtf8String("D:\\MyWorkspace\\Java\\ag-app-res\\ag-apps\\ag_app_res_description.txt");
        //屏幕尺寸
        ScreensDes screensDes = new ScreensDes();
        screensDes.setName("1080x");
        //配置
        ProjectJson projectJson = new ProjectJson();
        projectJson.setAppId("a51f38bee7ad412dab5e19d8ad20dadf");
        projectJson.setAppKey("Tnzs+RDOSrehPdTkr9eyV6AtCYC2n5MFYmaf+t1hU4AuCVBD6m8Xrgko0FrEC4yMdbF7H8Hu4xYa30FH5hcb8szUzIUIyQSkj2VmU0PFFSxRkRsA+uSwpi4/bo3wTL1EXf60X3FALfoUCDk6M6I/2iTj6Rgpi3ie4Gv0lpRKlEA=");
        projectJson.setDevQq("3502037911");
        projectJson.setDevPass("Talent0522..");

        //开始创建项目(如果不存在则创建，存在就不创建)
        ScriptProject scriptProject = new ScriptProject(projectPath, iconPath, desc);
        scriptProject.create(projectJson);

        //把项目中的图片转移到资源包中，并且替换代码中原本图片
        ScriptProjectImgsTranslator scriptProjectImgsTranslator = new ScriptProjectImgsTranslator(projectPath, screensDes);
        scriptProjectImgsTranslator.start();

        //把项目中的图片转移到资源包中，并且替换代码中原本图片
        ScriptProjectXmlsTranslator xmlsTranslator = new ScriptProjectXmlsTranslator(projectPath);
        xmlsTranslator.start();


        //生成清单文件
        ScriptProjectList scriptProjectList = new ScriptProjectList(projectPath);
        scriptProjectList.start();

        //最后打包
        ScriptProjectPackager scriptProjectPackager = new ScriptProjectPackager(projectPath);
        scriptProjectPackager.start();


    }
}
